
# Online Python - IDE, Editor, Compiler, Interpreter
a = []
b = input()
for i in b:
    if i =='(':
        a.append(i)
    if i =='[':
        a.append(i)
    if i =='{':
        a.append(i)
    if i =='<':
        a.append(i)
    if i == ')' and len(a) > 0 and a[-1] == '(':
        a.pop()
    if i == ']' and len(a) > 0 and a[-1] == '[':
        a.pop()
    if i == '}' and len(a) > 0 and a[-1] == '{':
        a.pop()
    if i == '>' and len(a) > 0 and a[-1] == '<':
        a.pop()
if len(a) > 0:
    print('False')
else:
    print('True')